﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserAdmin.aspx.cs" Inherits="Triad.Web.Admin.ASPMembership.UserAdmin" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>User Administration</title>
</head>
<body>
    <form id="frmMain" runat="server">
        <div>
            <table style="font-weight: normal; font-size: 12px; font-family: Arial" border="0"
                cellpadding="1" cellspacing="2" bgcolor="white" width="100%">
                <tr bgcolor="#ccffff">
                    <td align="center">
                        <b>List of the site users</b><br />
                        <tfc:tfListView ID="tfListView1" runat="server">
                        </tfc:tfListView>
                        <br />
                        <asp:GridView ID="GridViewMemberUser" runat="server" OnSelectedIndexChanged="GridViewMembershipUser_SelectedIndexChanged"
                            OnRowDeleted="GridViewMembership_RowDeleted" AllowPaging="True" AutoGenerateColumns="False"
                            DataKeyNames="UserName" DataSourceID="ObjectDataSourceMembershipUser" AllowSorting="True"
                            CellPadding="1" Font-Size="X-Small" Width="95%" ForeColor="#333333" GridLines="None"
                            BorderColor="White">
                            <Columns>
                                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" />
                                <asp:BoundField DataField="UserName" HeaderText="UserName" ReadOnly="true" SortExpression="UserName" />
                                <asp:BoundField DataField="FirstName" HeaderText="FirstName" ReadOnly="false" SortExpression="FirstName" />
                                <asp:BoundField DataField="LastName" HeaderText="LastName" ReadOnly="false" SortExpression="LastName" />
                                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                                <asp:BoundField DataField="PasswordQuestion" HeaderText="PasswordQuestion" ReadOnly="True"
                                    SortExpression="PasswordQuestion" />
                                <asp:BoundField DataField="Comment" HeaderText="Comment" SortExpression="Comment" />
                                <asp:BoundField DataField="CreationDate" HeaderText="CreationDate" ReadOnly="True"
                                    SortExpression="CreationDate" />
                                <asp:CheckBoxField DataField="IsApproved" HeaderText="IsApproved" SortExpression="IsApproved" />
                                <asp:BoundField DataField="LastLockoutDate" Visible="False" HeaderText="LastLockoutDate"
                                    ReadOnly="True" SortExpression="LastLockoutDate" />
                                <asp:BoundField DataField="LastLoginDate" HeaderText="LastLoginDate" SortExpression="LastLoginDate" Visible="False" />
                                <asp:CheckBoxField DataField="IsOnline" Visible="False" HeaderText="IsOnline" ReadOnly="True"
                                    SortExpression="IsOnline" />
                                <asp:CheckBoxField DataField="IsLockedOut" HeaderText="IsLockedOut" ReadOnly="True"
                                    SortExpression="IsLockedOut" Visible="False" />
                                <asp:BoundField DataField="LastActivityDate" HeaderText="LastActivityDate" SortExpression="LastActivityDate"
                                    Visible="False" />
                                <asp:BoundField DataField="LastPasswordChangedDate" HeaderText="LastPasswordChangedDate"
                                    Visible="False" ReadOnly="True" SortExpression="LastPasswordChangedDate" />
                                <asp:BoundField DataField="ProviderName" HeaderText="ProviderName" ReadOnly="True"
                                    Visible="False" SortExpression="ProviderName" />
                            </Columns>
                            <FooterStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True" />
                            <RowStyle BackColor="#EFF3FB" />
                            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                            <HeaderStyle BackColor="#507CD1" Font-Bold="False" ForeColor="White" />
                            <EditRowStyle BackColor="#2461BF" />
                            <AlternatingRowStyle BackColor="White" />
                        </asp:GridView>
                        <asp:ObjectDataSource ID="ObjectDataSourceMembershipUser" runat="server" DeleteMethod="Delete"
                            SelectMethod="GetMembers" TypeName="Triad.Web.Admin.ASPMembership.MembershipUserAndProfileODS"
                            UpdateMethod="Update" SortParameterName="SortData" OnInserted="ObjectDataSourceMembershipUser_Inserted">
                            <DeleteParameters>
                                <asp:Parameter Name="UserName" Type="String" />
                            </DeleteParameters>
                            <UpdateParameters>
                                <asp:Parameter Name="UserName" Type="String" />
                                <asp:Parameter Name="original_UserName" Type="String" />
                                <asp:Parameter Name="email" Type="String" />
                                <asp:Parameter Name="isLockedOut" Type="Boolean" />
                                <asp:Parameter Name="isApproved" Type="Boolean" />
                                <asp:Parameter Name="comment" Type="String" />
                                <asp:Parameter Name="lastActivityDate" Type="DateTime" />
                                <asp:Parameter Name="lastLoginDate" Type="DateTime" />
                                <asp:Parameter Name="firstName" Type="String" />
                                <asp:Parameter Name="lastName" Type="String" />
                                <asp:Parameter Name="advancedMode" Type="Boolean" />
                                <asp:Parameter Name="address_Street" Type="String" />
                                <asp:Parameter Name="address_City" Type="String" />
                                <asp:Parameter Name="address_State" Type="String" />
                                <asp:Parameter Name="address_Zip" Type="String" />
                            </UpdateParameters>
                            <SelectParameters>
                                <asp:Parameter Name="sortData" Type="String" />
                            </SelectParameters>
                        </asp:ObjectDataSource>
                        <br />
                    </td>
                </tr>
            </table>
            <table style="font-weight: normal; font-size: 12px; font-family: Arial" bgcolor="white"
                width="100%" border="0" cellpadding="1" cellspacing="2">
                <tr valign="top" bgcolor="#ccffff">
                    <td align="center" width="30%">
                        <b>Management of roles</b><br />
                        <br />
                        <asp:GridView ID="GridViewRole" runat="server" AutoGenerateColumns="False" DataSourceID="ObjectDataSourceRoleObject"
                            DataKeyNames="RoleName" CellPadding="3" CellSpacing="3" AllowPaging="True" HorizontalAlign="Center"
                            Width="100%" OnRowCommand="GridViewRole_RowCommand1" PageSize="7">
                            <Columns>
                                <asp:TemplateField ShowHeader="False">
                                    <ItemTemplate>
                                        <table>
                                            <tr>
                                                <td>
                                                    <asp:LinkButton ID="LinkButtonDelete" runat="server" CausesValidation="False" CommandName="Delete"
                                                        Text="Delete Role"></asp:LinkButton>
                                                </td>
                                                <td>
                                                    <asp:LinkButton ID="LinkButtonToggle" runat="server" CausesValidation="False" CommandName="Select"
                                                        CommandArgument='<%#(string) Eval("RoleName") + "^" + (string) Eval("UserName")  %>'
                                                        Text='<%# ShowInRoleStatus( (string) Eval("UserName"),(string) Eval("RoleName")) %>'>
                                                    </asp:LinkButton>
                                                </td>
                                            </tr>
                                        </table>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="NumberOfUsersInRole" HeaderText="Number Of Users In Role"
                                    SortExpression="NumberOfUsersInRole" />
                                <asp:BoundField DataField="RoleName" ReadOnly="True" Visible="False" HeaderText="RoleName"
                                    SortExpression="RoleName" />
                                <asp:CheckBoxField DataField="UserInRole" HeaderText="UserInRole" Visible="False"
                                    SortExpression="UserInRole" />
                            </Columns>
                        </asp:GridView>
                        <asp:CheckBox ID="CheckBoxShowRolesAssigned" runat="server" AutoPostBack="True" Text="Show Roles Assigned Only" />
                    </td>
                    <td align="center" width="30%">
                        <b>Creator of new role</b><br />
                        <br />
                        <asp:TextBox ID="TextBoxCreateNewRole" runat="server"></asp:TextBox><br />
                        <br />
                        <asp:Button ID="ButtonCreateNewRole" runat="server" OnClick="ButtonCreateNewRole_Click"
                            Text="Create New Role" /><br />
                    </td>
                    <td align="center" width="40%">
                        <b>Creator of new user</b><br />
                        <br />
                        <table cellpadding="2" cellspacing="2">
                            <tr>
                                <td style="height: 28px">
                                    <asp:Label ID="Label3" Text="UserName" runat="server"></asp:Label>
                                </td>
                                <td style="height: 28px">
                                    <asp:TextBox ID="TextBoxUserName" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="height: 28px">
                                    <asp:Label ID="Label1" Text="First Name" runat="server"></asp:Label>
                                </td>
                                <td style="height: 28px">
                                    <asp:TextBox ID="TextBoxFirstName" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td style="height: 28px">
                                    <asp:Label ID="Label7" Text="Last Name" runat="server"></asp:Label>
                                </td>
                                <td style="height: 28px">
                                    <asp:TextBox ID="TextBoxLastName" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            
                            
                            
                            <tr>
                                <td style="height: 28px">
                                    <asp:Label ID="Label4" Text="Password" runat="server"></asp:Label>
                                </td>
                                <td style="height: 28px">
                                    <asp:TextBox ID="TextBoxPassword" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="Label5" Text="PasswordQuestion" runat="server"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="TextBoxPasswordQuestion" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="Label6" Text="PasswordAnswer" runat="server"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="TextBoxPasswordAnswer" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="Label2" Text="Email" runat="server"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="TextBoxEmail" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="Label9" Text="Approved" runat="server"></asp:Label>
                                </td>
                                <td>
                                    <asp:CheckBox ID="CheckboxApproval" runat="server"></asp:CheckBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Button ID="ButtonNewUser" runat="server" Text="Create New User" OnClick="ButtonNewUser_Click" />
                                </td>
                            </tr>
                        </table>
                        <asp:Label ID="LabelInsertMessage" runat="server"></asp:Label>
                    </td>
                </tr>
            </table>
            <table style="font-weight: normal; font-size: 12px; font-family: Arial" border="0"
                cellpadding="1" cellspacing="2" bgcolor="white" width="100%">
                <tr bgcolor="#ccffff">
                    <td align="center">
                    </td>
                </tr>
            </table>
            <br />
            <asp:ObjectDataSource ID="ObjectDataSourceRoleObject" runat="server" SelectMethod="GetRoles"
                TypeName="Triad.Web.Admin.ASPMembership.RoleDataObjectForMP" InsertMethod="Insert" DeleteMethod="Delete">
                <SelectParameters>
                    <asp:ControlParameter ControlID="GridViewMemberUser" Name="UserName" PropertyName="SelectedValue"
                        Type="String" />
                    <asp:ControlParameter ControlID="CheckBoxShowRolesAssigned" Name="ShowOnlyAssignedRolls"
                        PropertyName="Checked" Type="Boolean" />
                </SelectParameters>
                <InsertParameters>
                    <asp:Parameter Name="RoleName" Type="String" />
                </InsertParameters>
                <DeleteParameters>
                    <asp:Parameter Name="RoleName" Type="String" />
                </DeleteParameters>
            </asp:ObjectDataSource>
        </div>

    </form>
</body>
</html>
